/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * {@code IPlayStrategy} define rules to create animation strategy for
 * the {@link MovieClipRT} class.
 * 
 * <p>To create and use your own strategy extends {@code MovieClipRT} or
 * {@code FrameControllerRT} and override the {@code _switchStrategy} 
 * to implement your own strategy selector.</p>
 * 
 * @author 	Cédric Néhémie
 * @see		MovieClipRT
 */
interface com.kairos.motion.strategy.IPlayStrategy 
{
	/**
	 * Returns {@code true} if the animation have to stop at the end
	 * of the playhead moves.
	 * 
	 * <p>Concret class witch are non-looping strategy may return false
	 * in {@code isMotionFinished} and matching looping condition only in
	 * {@code getNextFrame} method.</p>
	 * 
	 * @param	frame		The current frame in the {@code MovieClip}
	 * @param	totalFrames	The number of frames in the {@code MovieClip}
	 * @param	step		How many frames the playhead have to move.
	 * @return	{@code true} if the animation have to stop after the
	 * 			playhead moves, either {@code false}
	 */
	function isMotionFinished ( frame : Number, totalFrames : Number, step : Number ) : Boolean;
	
	/**
	 * Returns the next frame wherein the playhead can move.
	 * 
	 * <p>When building non-looping strategy the function may return
	 * the last valid frame wherin the playhead can move when arriving
	 * to the end condition during the move.</p>
	 * 
	 * @param	frame		The current frame in the {@code MovieClip}
	 * @param	totalFrames	The number of frames in the {@code MovieClip}
	 * @param	step		How many frames the playhead have to move.
	 * @return	A valid frame index in the {@code MovieClip}
	 */
	function getNextFrame ( frame : Number, totalFrames : Number, step : Number ) : Number;
}